home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS in a Box 7
/
BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso
/
Files
/
Tele
/
C
/
Comet2.1.3.cpt
/
emlib
/
macinit.c
< prev
next >
Wrap
Text File
|
1991-06-25
|
2KB
|
121 lines
/*
Copyright Cornell University 1986. All rights are reserved.
As of 4/10/86:
This source file may have no changes from the M.I.T original
other than this notice; but it has been tested as part of
Cornell's Aztec-C port. See notice.h
*/
/* macinit.c initializes the most general mac interfaces */
#include <em.h>
#include <inits.h>
#include <memory.h>
#include <h19.h>
#include <macdefs.h>
#define NUMMASTERS 10
/*
* Initialize macintosh fundamentals: memory, screen
*/
macinit(allocsize)
long allocsize;
{
char *bptr;
int count;
#ifdef NOSCRDMP
/* variable address for disabling system trap of top row command-shift keys */
char * ScrDmpEnb = 0x2f8;
*ScrDmpEnb = 0;
/* disables command-shift-number trap; this means the event mgr
* will no longer do screen dumps
*/
#endif
bptr = (char *) NewPtr(allocsize);
if (bptr == (char *) NULL) {
SysBeep(5);
}
else {
DisposPtr(bptr);
}
MaxApplZone();
for (count = NUMMASTERS; count--; ) {
MoreMasters();
}
InitGraf(&thePort);
InitFonts();
InitWindows();
InitMenus();
TEInit();
InitDialogs((ProcPtr) NULL);
InitCursor();
keyinit(); /* change the key mapping for e i n u */
globalconfig();
#ifdef SETGROWZONE
/* Doesn't work under MF */
/* allocate a grow block and set our grow zone function */
{
extern pascal long growzone();
growblock = NewHandle(GROWBLOCKSIZE);
SetGrowZone(growzone);
}
#endif
}
#ifdef SETGROWZONE
#define GROWBLOCKSIZE 6000 /* leave size zero unless need demonstrated */
Handle growblock; /* Handle to memory to free up */
pascal long growzone(growsize)
long growsize;
{
static long growleft = GROWBLOCKSIZE;
if (*GZRootHnd != NULL) {
HLock(GZRootHnd);
}
if (growleft < growsize) {
growsize = growleft;
if (growleft)
DisposHandle(growblock);
growleft = 0;
}
else {
growleft -= growsize;
SetHandleSize(growblock, growleft);
}
if (*GZRootHnd != NULL) {
HUnlock(GZRootHnd);
}
if (growleft < 5000) {
pr25(0, "You're VERY short of memory!");
}
else {
prerr25("You're running short of memory!");
}
return(growsize);
}
#endif